package com.pigcloud.sop.gateway.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.FieldNameConstants;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 限流配置
 * </p>
 *
 * @author wangfm
 * @since 2024-01-03
 */
@Data
@FieldNameConstants
@TableName("config_limit")
@ApiModel("ConfigLimit")
public class ConfigLimit{
    @TableId("id")
    private Long id;
    @ApiModelProperty("路由id")
    @TableField("route_id")
    private String routeId;

    @TableField("app_key")
    private String appKey;

    @ApiModelProperty("限流ip，多个用英文逗号隔开")
    @TableField("limit_ip")
    private String limitIp;

    @ApiModelProperty("服务id")
    @TableField("service_id")
    private String serviceId;

    @ApiModelProperty("限流策略，1：窗口策略，2：令牌桶策略")
    @TableField("limit_type")
    private Integer limitType;

    @ApiModelProperty("每秒可处理请求数")
    @TableField("exec_count_per_second")
    private Integer execCountPerSecond;

    @ApiModelProperty("限流持续时间，默认1秒，即每durationSeconds秒允许多少请求（当limit_type=1时有效）")
    @TableField("duration_seconds")
    private Integer durationSeconds;

    @ApiModelProperty("返回的错误码")
    @TableField("limit_code")
    private String limitCode;

    @ApiModelProperty("返回的错误信息")
    @TableField("limit_msg")
    private String limitMsg;

    @ApiModelProperty("令牌桶容量")
    @TableField("token_bucket_count")
    private Integer tokenBucketCount;

    @ApiModelProperty("限流开启状态，1:开启，0关闭")
    @TableField("limit_status")
    private Integer limitStatus;

    @ApiModelProperty("顺序，值小的优先执行")
    @TableField("order_index")
    private Integer orderIndex;

    @ApiModelProperty("备注")
    @TableField("remark")
    private String remark;

    @TableField("create_time")
    private LocalDateTime createTime;

    @TableField("update_time")
    private LocalDateTime updateTime;


}
